//
//  UIView+HDTimeHeaderView.m
//  app
//
//  Created by D on 15/7/13.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "HDTimeHeaderView.h"

static CGFloat kMargin = 24.0f;
static CGFloat kTimeH = 20.0f;
static CGFloat kTimeW = 60.0f;

@implementation HDTimeHeaderView

-(id)initWithDic:(NSString *)dic
{
    if (self = [super init]) {
        
        self.frame = CGRectMake(0, 0, UBO_WINDOW.width, 30);
        self.backgroundColor = [UIColor clearColor];
        
        self.mianView = [[UIView alloc]initWithFrame:CGRectOf([self.ubo fx:UB_1_2 ox:-UBO_WINDOW.width/2 fy:UB_1_2 oy:-15], [self.ubo  ow:UBO_WINDOW.width oh:30])];
//        self.mianView.backgroundColor = [UIColor yellowColor];
        [self addSubview:self.mianView];
        
        self.timeLabel = [[UILabel alloc]initWithFrame:CGRectOf([self.mianView.ufo fx:UB_1_2 ox:-kTimeW/2 fy:UB_1_2 oy:-kTimeH/2 ], [self.ubo ow:kTimeW oh:kTimeH])];
        self.timeLabel.text = [XCommon timeFromNowSinceDateline:dic];
        [self.timeLabel setTextColor:[UIColor whiteColor]];
        self.timeLabel.backgroundColor = [UIColor colorWithRed:214.0/255.0 green:214.0/255.0 blue:214.0/255.0 alpha:1.0];
        self.timeLabel.layer.masksToBounds = YES;
        self.timeLabel.layer.cornerRadius = UF(10);
        self.timeLabel.font = JKAppGlobleFontMinTagText;
        [self.timeLabel setTextAlignment:NSTextAlignmentCenter];
        [self addSubview:self.timeLabel];

    }
    return self;
}

@end
